<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Set</title>
</head>
<body>
    <script>
        // 声明集合
        //空集合
        let s1 = new Set();
        // 初始化一个集合
        let s2 = new Set([1,2,3,4,2,3,4]);
        
        // add 添加元素
        s2.add(5);
        // delete 删除元素
        s2.delete(2);
        // has 查看是否有某个元素 返回boolean
        console.log(s2.has(13));
        // size 元素个数
        console.log(s2.size);
        // clear 清空集合
        s2.clear();
        console.log(s2);
        // 遍历结合

        let s3 = new Set([4,5,2,4,67,8]);
        for(let v of s3.entries()){
            console.log(v);
        }
        

    </script>
</body>
</html>